<?php
/**
 * Created by PhpStorm.
 * User: liu85
 * Date: 2019/2/26
 * Time: 21:43
 */

namespace app\common\service;


use app\common\model\User;

class UserService
{
    /**
     * @param $ids
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public static function batchUserByIds($ids)
    {
        $map[] = ['id', 'in', $ids];
        $model = new User();
        $list = $model->where($map)->select();
        $newList = [];
        foreach ($ids as $v){
            foreach($list as $value){
                if($value['id'] == $v){
                    $newList[$v] = $value;
                }
            }
        }
        return $newList;
    }
}